<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>银行卡管理</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/swiper.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/layer.css" />
    <link rel="stylesheet" type="text/css" href="../css/mdw.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../script/swiper.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/layer.js"></script>
    <script type="text/javascript" src="../script/mdw.js"></script>
    <script type="text/javascript" src="../script/jumpPage.js"></script>

</head>
<body class="bg-eee">
    <header class="header">
        <div class="backPrevPage on" onclick="historyBack()"></div>
        <div class="pageTitle">银行卡管理</div>

    </header>
    <section class="bankCardPage plr HTML_BOX">
      <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
      <ul class="cardList">
        <!-- <li>
          <div class="cardBox1">
            <div class="cardType"><i class="mastercard"></i>mastercard</div>
            <div class="cardTitle">
              <span>****</span><span>****</span><span>****</span><span>7258</span>
            </div>
          </div>
          <div class="cardDel"><i class="icon"></i></div>
        </li>
        <li>
          <div class="cardBox1">
            <div class="cardType"><i class="visa"></i></div>
            <div class="cardTitle">
              <span>****</span><span>****</span><span>****</span><span>7258</span>
            </div>
          </div>
          <div class="cardDel"><i class="icon"></i></div>
        </li> -->
      </ul>
       <div onclick="openWin('bankCard_add','bankCard_add.html');" class="addCard">
         <i></i><span>添加银行卡</span>
       </div>
    </section>

</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
  function cardDel(e,id){
    pop.loading();
    getAjax(Interface.del_card,{token:token,id:id},function(res){
      pop.close();
      deleteElement($(e).parent("li"));
    },function(res,err){})

  }
    apiready = function(){
       $api.fixStatusBar($api.dom('header'));
        api.setStatusBarStyle({
            color: '#fff',//设置APP状态栏背景色
            style: 'dark'
        });
        api.addEventListener({
            name: 'add_bank'
        }, function(ret, err) {
            ready();
        });
        ifCnAndEn();
        ready();
    };

    function ready(){
        getAjax(Interface.list_card,{token:token},function(res){
          console.log(JSON.stringify(res));
          if(res.data){
            var html ='';
            $.each(res.data,function(i,item){
              var number = item.card_numb.substr(item.card_numb.length-4);
              html+='<li>';
                html+='<div class="cardBox1">';
                  html+='<div class="cardType"><i class="visa"></i></div>';
                  html+='<div class="cardTitle">';
                    html+='<span>****</span><span>****</span><span>****</span><span>'+number+'</span>';
                  html+='</div>';
                html+='</div>';
                html+='<div onclick="cardDel(this,'+item.id+');" class="cardDel"><i class="icon"></i></div>';
              html+='</li>';

            })
            $(".cardList").html(html);
          }
        },function(res,err){});
    }
</script>
<script type="text/javascript">
    function ifCnAndEn(){
        if(cnen==2){
          $(".pageTitle").html("Bank Card List");
          $(".addCard span").html("Add bank card");
        }

    }
</script>
</html>
